﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CommonProject_DeskTop.ViewModel
{
    public class ViewModelLocator
    {
        public IServiceProvider Services { get; }
        public ViewModelLocator() {
            Services = ConfigureServices();
        }
        private static IServiceProvider ConfigureServices()
        {
            var services = new ServiceCollection();
            //services.AddSingleton<IStudentService, StudentService>();
            services.AddSingleton<MainViewModel>();
            return services.BuildServiceProvider();
        }
        public MainViewModel Main => Services.GetService<MainViewModel>();
    }
}
